const Router = require('koa-router');
const router = new Router({ prefix: '/api/clinic' });
const { Clinic } = require('../models/clinicModel');

// 获取诊所列表
router.get('/list', async (ctx) => {
  try {
    const clinics = await Clinic.findAll();
    ctx.status = 200;
    ctx.body = {
      code: 200,
      message: '获取诊所列表成功',
      data: clinics
    };
  } catch (error) {
    console.error('获取诊所列表失败：', error);
    ctx.status = 500;
    ctx.body = {
      code: 500,
      message: '获取诊所列表失败，请稍后重试',
      error: error.message
    };
  }
});



module.exports = router;